<script>
import OutboundRecordWithItemForm from './OutboundRecordWithItemForm.vue'

export default {
  name: 'OutboundRecordWithItemModal',
  components: { OutboundRecordWithItemForm },
  data() {
    return {
      title: '',
      width: 800,
      visible: false,
      disableSubmit: false,
      warehouseCode: null
    }
  },
  methods: {
    add(record) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.insert(record)
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      this.$refs.realForm.handleSubmit()
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>

<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    fullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">
    <outbound-record-with-item-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" />
  </j-modal>
</template>

<style scoped>

</style>